package com.nhxcz.bigdataweb.mapper;

import com.nhxcz.bigdataweb.entity.Count;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public interface CountMapper {

    @Select("SELECT * FROM currentcount WHERE longitude = #{longitude}")
    Count getLon(double longitude);

    @Select("SELECT longitude, latitude,count FROM currentcount")
    ArrayList<Count> print();

    @Select("SELECT * FROM currentcount ORDER BY count desc limit 10 ")
    ArrayList<Count> top();

    @Select("SELECT COUNT(imsi) FROM move_type WHERE type=0")
    int bus();

    @Select("SELECT COUNT(imsi) FROM move_type WHERE type=1")
    int car();

    @Select("SELECT COUNT(imsi) FROM move_type WHERE type=2")
    int walk();

    @Select("SELECT COUNT(imsi) FROM move_type WHERE type=3")
    int train();

    @Select("SELECT COUNT(imsi) FROM move_type WHERE type=4")
    int bike();

    @Select("SELECT COUNT(imsi) FROM move_type")
    int traffic();

    @Select("SELECT time FROM move_type limit 0,1")
    String  time();

}